<script>

  saveBtn(){
    console.log(this.row);
    if(!this.row){
      this.$alert('暂无可以保存的数据','提示');
      return false;
    }
    if(this.row.section_principal_id ==this.user_id&&(!this.row.rectification_measures[0]||!this.row.rectification_measures[1])
      &&((this.row.rectification_state[0]==0||this.row.rectification_state[0]=='')||(this.row.rectification_state[1]==0||this.row.rectification_state[1]==''))&&(!this.row.task_allocation_state)
    ){
      console.log(this.row.task_allocation)
      console.log('责任部门主管的第一步操作')
      var arr=[];
      for(var i in this.tableData){
        if(this.tableData[i].disabled=="1"){
          if(!this.tableData[i].mend_principal[1]){
            arr[0]=this.tableData[i].mend_principal[0].id;
            if(!arr[0]){
              this.$alert('请选择整改人','提示');
              return false;
            }
            this.message[0]={
              mess_receiver:this.tableData[i].mend_principal[0].id,
              mess_type:10,
              mess_link:'/defectFixed'
            }
          }else{
            arr[0]=this.tableData[i].mend_principal[0].id;
            arr[1]=this.tableData[i].mend_principal[1].id;
            if(!arr[0]||!arr[1]){
              this.$alert('请选择整改人','提示');
              return false;
            }
            this.message[0]={
              mess_receiver:this.tableData[i].mend_principal[0].id,
              mess_type:9,
              mess_link:'/defectFixed'
            };
            this.message[1]={
              mess_receiver:this.tableData[i].mend_principal[1].id,
              mess_type:9,
              mess_link:'/defectFixed'
            }
          };
          if(this.tableData[i].defect_state==0){
            this.$alert('请确认缺陷','提示');
            return false;
          }
          this.axios.put('/api/v1/flaw/defectrectification/'+`${this.tableData[i].dere_id}`,{
            defect_state:this.tableData[i].defect_state,
            rectification_type:this.tableData[i].rectification_type,
            defect_principal:arr,
            communication_ideas:this.tableData[i].communication_ideas
          }).then((res)=>{
            this.disabled =0;
            this.tableData[this.rowIndex].disabled =0;
            this.step1=true;
            this.step2=false;
            this.step3=false;
            this.step4=true;
            this.step5=false;
            this.$alert('操作成功','提示');
            this.putMessage(this.message);
          })
          return false;
        }
      }
//保存第二步操作
//如何区分第二步和第四步？
    }else  if(!this.step4 &&this.step2&&this.row.mend_principal&&this.row.task_allocation_state==1&&(this.row.rectification_measures[0]||this.row.rectification_measures[1])
      &&(this.row.mend_principal[0].id==this.user_id||(this.row.mend_principal[1]&&this.row.mend_principal[1].id==this.user_id
        &&(this.row.rectification_results_input[0]!=1||this.row.rectification_results_input[1]!=1))
      )
    ){

//第四步的操作
      if(this.row.review_rectificationplan_state[0]==1&&this.row.review_rectificationplan_state[1]==0){
        if(this.row.rectification_state[1]==2){
//第二个复核被拒
          console.log(this.row.rectification_results)
          if(this.row.mend_principal[1].id==this.user_id&&
            !this.row.rectification_results[1]){
            if(this.row.section_principal_id==this.user_id){
              this.axios.put('/api/v1/flaw/compilerectificationplan/'+`${this.row.dere_id}`,{
                defect_reason_analysis:[this.row.defect_reason_analysis[0],this.row.defect_reason_analysis[1]],
                rectification_measures:[this.row.rectification_measures[0],this.row.rectification_measures[1]],
                evaluation_finishtime:[parseInt(new Date((this.row.evaluation_finishtime[0])).getTime()/1000),parseInt(new Date((this.row.evaluation_finishtime[1])).getTime()/1000)],
                dere_id:this.row.dere_id
              })
                .then((res)=>{
                  if(res.data.code==0){
                    this.$alert(res.data.message,'提示');
                    this.disabled =0;
                    this.step1=true;
                    this.step2=false;
                    this.step3=false;
                    this.step4=true;
                    this.step5=false;
                    this.message[0]={
                      mess_receiver:this.tableData[this.row.index].guidance_id,
                      mess_type:13,
                      mess_link:'/defectFixed'
                    };
                    this.tableData[this.rowIndex].disabled =0;
                    this.tableData[this.rowIndex].reason_analysis =0;
                    this.tableData[this.rowIndex].reCheck =0;
                    this.putMessage(this.message);
                    return false;
                  }else{
                    this.$alert(res.data.message,'提示')
                  }
                })
            }else{
//编制整改确定 第2步第二个重新填写
              console.log('编制整改计划重填')

              this.axios.put('/api/v1/flaw/compilerectificationplan/'+`${this.row.dere_id}`,{
                defect_reason_analysis:[this.row.defect_reason_analysis[0],this.row.defect_reason_analysis[1]],
                rectification_measures:[this.row.rectification_measures[0],this.row.rectification_measures[1]],
                evaluation_finishtime:[parseInt(new Date((this.row.evaluation_finishtime[0])).getTime()/1000),parseInt(new Date((this.row.evaluation_finishtime[1])).getTime()/1000)],
                dere_id:this.row.dere_id
              })
                .then((res)=>{
                  if(res.data.code==0){
                    this.$alert(res.data.message,'提示');
                    this.disabled =0;
                    this.step1=true;
                    this.step2=false;
                    this.step3=false;
                    this.step4=true;
                    this.step5=false;
                    this.tableData[this.rowIndex].disabled =0;
                    this.tableData[this.rowIndex].reason_analysis =0;
                    this.tableData[this.rowIndex].reCheck =0;
                    this.message[0]={
                      mess_receiver:this.tableData[this.row.index].section_principal_id,
                      mess_type:13,
                      mess_link:'/defectFixed'
                    };
                    console.log(this.message)
                    this.putMessage(this.message);
                    return false;
                  }else{
                    this.$alert(res.data.message,'提示')
                  }
                })
            }
          }
        }
        console.log('第四步操作，提交整改人员的确认数据');
        if(this.row.mend_principal[0].id==this.user_id){
          this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
            rectification_results:[this.row.rectification_results[0]],
            reasons_measures:[this.row.reasons_measures[0]]
          })
            .then((res)=>{
              if(res.data.code==0){
                this.$alert(res.data.message,'提示');
                this.disabled =0;
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                if(this.row.rectification_results){
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].evaluator_id,
                    mess_type:2,
                    mess_link:'/defectFixed'
                  };
                };
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
                this.putMessage(this.message);
                return false;
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }else if(this.row.mend_principal[1].id==this.user_id){
          if(this.row.review_rectificationplan_state[1]==0){
//第二步的操作
            console.log('编制整改的第二步操作');
            var compilerectificationplan=[],defect_reason_analysis=[],rectification_measures=[],evaluation_finishtime=[];
            if(this.row.mend_principal.length==2&&this.row.mend_principal[0].id==this.row.mend_principal[1].id){
              if(this.row.mend_principal[0].id==this.row.mend_principal[1].id&&
                this.row.mend_principal[0].id==this.user_id){


                for(var k in this.row.mend_principal){
                  defect_reason_analysis[k]=this.row.defect_reason_analysis[k];
                  rectification_measures[k]=this.row.rectification_measures[k];
                  evaluation_finishtime[k]=parseInt(new Date((this.row.evaluation_finishtime[k])).getTime()/1000);
                };
                this.axios.put('/api/v1/flaw/compilerectificationplan/'+`${this.row.dere_id}`,{
                  defect_reason_analysis:defect_reason_analysis,
                  rectification_measures:rectification_measures,
                  evaluation_finishtime:evaluation_finishtime,
                  dere_id:this.row.dere_id
                })
                  .then((res)=>{
                    if(res.data.code==0){
//确定是整改任务分配相关操作人员才能进行的权限处理
//增加一条 当责任部门负责人和编制整改任务分配负责人是同一人时候 复核整改计划需要指定为部门直系领导参与
// 及此时不仅需要给编制整改计划人员发送消息以为还需要给复核整改计划人员发送相消息
                      if(this.row.review_rectificationplan_state[0]==0&&this.row.review_rectificationplan_state[1]==1){
//第二条编制整改计划完成 第一条未完成
                        if( this.row.mend_principal[0].id==this.user_id&&this.row.mend_principal[0].id==this.row.section_principal_id){
                          this.message[0]={
                            mess_receiver:this.tableData[this.row.index].guidance_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          };
                        }else{
                          this.message[0]={
                            mess_receiver:this.tableData[this.row.index].section_principal_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          };
                        }

                      }else if(this.row.review_rectificationplan_state[0]==0&&this.row.review_rectificationplan_state[1]==0){
                        if(this.row.section_principal_id==this.row.mend_principal[0].id
                          &&this.user_id==this.row.mend_principal[0].id
                          &&this.row.mend_principal[0].id!=this.row.mend_principal[1].id){
                          this.message[0]={
                            mess_receiver:this.tableData[this.row.index].guidance_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          };
                          this.message[1]={
                            mess_receiver:this.tableData[this.row.index].section_principal_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          }
                        }else if(this.row.section_principal_id==this.row.mend_principal[1].id
                          &&this.user_id==this.row.mend_principal[1].id
                          &&this.row.mend_principal[0].id!=this.row.mend_principal[1].id){
                          this.message[0]={
                            mess_receiver:this.tableData[this.row.index].section_principal_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          };
                          this.message[1]={
                            mess_receiver:this.tableData[this.row.index].guidance_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          }
                        }else if(this.row.section_principal_id==this.row.mend_principal[0].id
                          &&this.user_id==this.row.mend_principal[0].id
                          &&this.row.mend_principal[0].id==this.row.mend_principal[1].id){
                          this.message[0]={
                            mess_receiver:this.tableData[this.row.index].guidance_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          };
                          this.message[1]={
                            mess_receiver:this.tableData[this.row.index].guidance_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          }
                        }else{
                          this.message[0]={
                            mess_receiver:this.tableData[this.row.index].section_principal_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          };
                          this.message[1]={
                            mess_receiver:this.tableData[this.row.index].section_principal_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          }
                        }

                      }else if(this.row.review_rectificationplan_state[0]==1&&this.row.review_rectificationplan_state[1]==0){
                        if(this.row.section_principal_id==this.row.mend_principal[1].id){
                          this.message[0]={
                            mess_receiver:this.tableData[this.row.index].guidance_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          };
                        }else{
                          this.message[0]={
                            mess_receiver:this.tableData[this.row.index].section_principal_id,
                            mess_type:11,
                            mess_link:'/defectFixed'
                          };
                        }
                      }
                      this.$alert('操作成功','提示');
                      this.disabled =0;
                      this.tableData[this.rowIndex].disabled =0;
                      this.tableData[this.rowIndex].reason_analysis =0;
                      this.step1=true;
                      this.step2=false;
                      this.step3=false;
                      this.step4=true;
                      this.step5=false;
                      this.putMessage(this.message);
                    }else{
                      this.$alert(res.data.message,'提示')
                    }
                  })
              }
            }else if(this.row.mend_principal.length==1&&this.row.mend_principal[0].id==this.user_id){

              for(var k in this.row.mend_principal){
                defect_reason_analysis[k]=this.row.defect_reason_analysis[k];
                rectification_measures[k]=this.row.rectification_measures[k];
                evaluation_finishtime[k]=parseInt(new Date((this.row.evaluation_finishtime[k])).getTime()/1000);
              };
              this.axios.put('/api/v1/flaw/compilerectificationplan/'+`${this.row.dere_id}`,{
                defect_reason_analysis:defect_reason_analysis,
                rectification_measures:rectification_measures,
                evaluation_finishtime:evaluation_finishtime,
                dere_id:this.row.dere_id
              })
                .then((res)=>{
                  if(res.data.code==0){
                    this.$alert('操作成功','提示');
                    this.message[0]={
                      mess_receiver:this.tableData[this.rowIndex].section_principal_id,
                      mess_type:11,
                      mess_link:'/defectFixed'
                    };
                    this.disabled =0;
                    this.tableData[this.rowIndex].disabled =0;
                    this.tableData[this.rowIndex].reason_analysis =0;
                    this.step1=true;
                    this.step2=false;
                    this.step3=false;
                    this.step4=true;
                    this.step5=false;
                    this.putMessage(this.message);
                  }else{
                    this.$alert(res.data.message,'提示')
                  }
                })
            }else {
              for(var k in this.row.mend_principal){
                if(this.row.mend_principal[k].id ==this.user_id){
                  this.message[k]={
                    mess_receiver:this.tableData[this.rowIndex].section_principal_id,
                    mess_type:11,
                    mess_link:'/defectFixed'
                  };
                  this.axios.put('/api/v1/flaw/compilerectificationplan/'+`${this.row.dere_id}`,{
                    defect_reason_analysis:[this.row.defect_reason_analysis[k]],
                    rectification_measures:[this.row.rectification_measures[k]],
                    evaluation_finishtime:[parseInt(new Date((this.row.evaluation_finishtime[k])).getTime()/1000)],
                    dere_id:this.row.dere_id
                  })
                    .then((res)=>{
                      if(res.data.code==0){
                        this.$alert('操作成功','提示');
                        this.disabled =0;
                        this.tableData[this.rowIndex].disabled =0;
                        this.tableData[this.rowIndex].reason_analysis =0;
                        this.step1=true;
                        this.step2=false;
                        this.step3=false;
                        this.step4=true;
                        this.step5=false;
                        this.putMessage(this.message);
                      }else{
                        this.$alert(res.data.message,'提示');
                      }
                    })
                }
              }
            }
          }
        }

      }else if(this.row.review_rectificationplan_state[1]==1&&this.row.review_rectificationplan_state[0]==0){
//第二步操作
        var compilerectificationplan=[],defect_reason_analysis=[],rectification_measures=[],evaluation_finishtime=[];

        defect_reason_analysis[0]=this.row.defect_reason_analysis[0];
        rectification_measures[0]=this.row.rectification_measures[0];
        evaluation_finishtime[0]=parseInt(new Date((this.row.evaluation_finishtime[0])).getTime()/1000);
        this.axios.put('/api/v1/flaw/compilerectificationplan/'+`${this.row.dere_id}`,{
          defect_reason_analysis:defect_reason_analysis,
          rectification_measures:rectification_measures,
          evaluation_finishtime:evaluation_finishtime,
          dere_id:this.row.dere_id
        })
          .then((res)=>{
            if(res.data.code==0){
              this.$alert('操作成功','提示');
              if( this.row.mend_principal[0].id==this.user_id&&this.row.mend_principal[0].id==this.row.section_principal_id){
                this.message[0]={
                  mess_receiver:this.tableData[this.row.index].guidance_id,
                  mess_type:11,
                  mess_link:'/defectFixed'
                };
              }else{
                this.message[0]={
                  mess_receiver:this.tableData[this.row.index].section_principal_id,
                  mess_type:11,
                  mess_link:'/defectFixed'
                };
              }
              this.disabled =0;
              this.tableData[this.rowIndex].disabled =0;
              this.tableData[this.rowIndex].reason_analysis =0;
              this.step1=true;
              this.step2=false;
              this.step3=false;
              this.step4=true;
              this.step5=false;
              this.putMessage(this.message);
              return false;
            }else{
              this.$alert(res.data.message,'提示')
            }
          })
//或者进行第四步操作
        if(this.row.mend_principal[1].id==this.user_id){

          this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
            rectification_results:[this.row.rectification_results[1]],
            reasons_measures:[this.row.reasons_measures[1]]
          })
            .then((res)=>{
              if(res.data.code==0){
                if(this.row.rectification_results[1]){
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].evaluator_id,
                    mess_type:14,
                    mess_link:'/defectFixed'
                  };
                };
                this.$alert(res.data.message,'提示');
                this.disabled =0;
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }
      }else if(this.row.review_rectificationplan_state[1]==1&&this.row.review_rectificationplan_state[0]==1){

        if(this.row.mend_principal[1].id==this.user_id&&this.row.mend_principal[0].id==this.user_id){

          this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
            rectification_results:[this.row.rectification_results[0],this.row.rectification_results[1]],
            reasons_measures:[this.row.reasons_measures[0],this.row.reasons_measures[1]]
          })
            .then((res)=>{
              if(res.data.code==0){
                if(this.row.rectification_results[0]){
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].evaluator_id,
                    mess_type:14,
                    mess_link:'/defectFixed'
                  };
                };
                if(this.row.rectification_results[1]){
                  this.message[1]={
                    mess_receiver:this.tableData[this.row.index].evaluator_id,
                    mess_type:14,
                    mess_link:'/defectFixed'
                  };
                };
                this.$alert(res.data.message,'提示');
                this.disabled =0;
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
                this.putMessage(this.message)
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }else if(this.row.mend_principal[1].id==this.user_id&&this.row.mend_principal[0].id!=this.user_id){
//执行第四步的提交
//提交第二个人的数据

          this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
            rectification_results:[this.row.rectification_results[1]],
            reasons_measures:[this.row.reasons_measures[1]]
          })
            .then((res)=>{
              if(res.data.code==0){
                this.$alert(res.data.message,'提示');
                this.disabled =0;
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
                if(this.row.rectification_results[1]){
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].evaluator_id,
                    mess_type:14,
                    mess_link:'/defectFixed'
                  };
                };
                this.putMessage(this.message)
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }else if(this.row.mend_principal[0].id==this.user_id&&this.row.mend_principal[1].id!=this.user_id){

          this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
            rectification_results:[this.row.rectification_results[0]],
            reasons_measures:[this.row.reasons_measures[0]]
          })
            .then((res)=>{
              if(res.data.code==0){
                this.$alert(res.data.message,'提示');
                this.disabled =0;
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                if(this.row.rectification_results[0]){
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].evaluator_id,
                    mess_type:14,
                    mess_link:'/defectFixed'
                  };
                };
                this.putMessage(this.message)
                this.step5=false;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }
      }
      else{
//   //第二步的操作
//          alert(this.step2)
        console.log('编制整改的第二步操作');
        var compilerectificationplan=[],defect_reason_analysis=[],rectification_measures=[],evaluation_finishtime=[];
        if(this.row.mend_principal.length==2&&this.row.mend_principal[0].id==this.row.mend_principal[1].id){
          if(this.row.mend_principal[0].id==this.row.mend_principal[1].id&&
            this.row.mend_principal[0].id==this.user_id){

            for(var k in this.row.mend_principal){
              defect_reason_analysis[k]=this.row.defect_reason_analysis[k];
              rectification_measures[k]=this.row.rectification_measures[k];
              evaluation_finishtime[k]=parseInt(new Date((this.row.evaluation_finishtime[k])).getTime()/1000);
            };
            this.axios.put('/api/v1/flaw/compilerectificationplan/'+`${this.row.dere_id}`,{
              defect_reason_analysis:defect_reason_analysis,
              rectification_measures:rectification_measures,
              evaluation_finishtime:evaluation_finishtime,
              dere_id:this.row.dere_id
            })
              .then((res)=>{
                if(res.data.code==0){
//确定是整改任务分配相关操作人员才能进行的权限处理
//增加一条 当责任部门负责人和编制整改任务分配负责人是同一人时候 复核整改计划需要指定为部门直系领导参与
// 及此时不仅需要给编制整改计划人员发送消息以为还需要给复核整改计划人员发送相消息
                  if(this.row.review_rectificationplan_state[0]==0&&this.row.review_rectificationplan_state[1]==1){
//第二条编制整改计划完成 第一条未完成
                    if( this.row.mend_principal[0].id==this.user_id&&this.row.mend_principal[0].id==this.row.section_principal_id){
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].guidance_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      };
                    }else{
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].section_principal_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      };
                    }

                  }else if(this.row.review_rectificationplan_state[0]==0&&this.row.review_rectificationplan_state[1]==0){
                    if(this.row.section_principal_id==this.row.mend_principal[0].id
                      &&this.user_id==this.row.mend_principal[0].id
                      &&this.row.mend_principal[0].id!=this.row.mend_principal[1].id){
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].guidance_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      };
                      this.message[1]={
                        mess_receiver:this.tableData[this.row.index].section_principal_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      }
                    }else if(this.row.section_principal_id==this.row.mend_principal[1].id
                      &&this.user_id==this.row.mend_principal[1].id
                      &&this.row.mend_principal[0].id!=this.row.mend_principal[1].id){
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].section_principal_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      };
                      this.message[1]={
                        mess_receiver:this.tableData[this.row.index].guidance_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      }
                    }else if(this.row.section_principal_id==this.row.mend_principal[0].id
                      &&this.user_id==this.row.mend_principal[0].id
                      &&this.row.mend_principal[0].id==this.row.mend_principal[1].id){
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].guidance_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      };
                      this.message[1]={
                        mess_receiver:this.tableData[this.row.index].guidance_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      }
                    }else{
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].section_principal_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      };
                      this.message[1]={
                        mess_receiver:this.tableData[this.row.index].section_principal_id,
                        mess_type:13,
                        mess_link:'/defectFixed'
                      }
                    }

                  }else if(this.row.review_rectificationplan_state[0]==1&&this.row.review_rectificationplan_state[1]==0){
                    if(this.row.section_principal_id==this.row.mend_principal[1].id){
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].guidance_id,
                        mess_type:11,
                        mess_link:'/defectFixed'
                      };
                    }else{
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].section_principal_id,
                        mess_type:11,
                        mess_link:'/defectFixed'
                      };
                    }
                  };
                  this.$alert('操作成功','提示');
                  this.disabled =0;
                  this.tableData[this.rowIndex].disabled =0;
                  this.tableData[this.rowIndex].reason_analysis =0;
                  this.step1=true;
                  this.step2=false;
                  this.step3=false;
                  this.step4=true;
                  this.step5=false;
                  this.putMessage(this.message);
                }else{
                  this.$alert(res.data.message,'提示')
                }
              })
          }
        }else if(this.row.mend_principal.length==1&&this.row.mend_principal[0].id==this.user_id){

          for(var k in this.row.mend_principal){
            defect_reason_analysis[k]=this.row.defect_reason_analysis[k];
            rectification_measures[k]=this.row.rectification_measures[k];
            evaluation_finishtime[k]=parseInt(new Date((this.row.evaluation_finishtime[k])).getTime()/1000);
          };
          this.axios.put('/api/v1/flaw/compilerectificationplan/'+`${this.row.dere_id}`,{
            defect_reason_analysis:defect_reason_analysis,
            rectification_measures:rectification_measures,
            evaluation_finishtime:evaluation_finishtime,
            dere_id:this.row.dere_id
          })
            .then((res)=>{
              if(res.data.code==0){
                this.message[0]={
                  mess_receiver:this.tableData[this.rowIndex].section_principal_id,
                  mess_type:11,
                  mess_link:'/defectFixed'
                };
                this.$alert('操作成功','提示');
                this.disabled =0;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.putMessage(this.message);
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }else {
          for(var k in this.row.mend_principal){
            if(this.row.mend_principal[k].id ==this.user_id){

              this.axios.put('/api/v1/flaw/compilerectificationplan/'+`${this.row.dere_id}`,{
                defect_reason_analysis:[this.row.defect_reason_analysis[k]],
                rectification_measures:[this.row.rectification_measures[k]],
                evaluation_finishtime:[parseInt(new Date((this.row.evaluation_finishtime[k])).getTime()/1000)],
                dere_id:this.row.dere_id
              })
                .then((res)=>{
                  if(res.data.code==0){
                    this.$alert('操作成功','提示');
                    this.disabled =0;
                    this.tableData[this.rowIndex].disabled =0;
                    this.tableData[this.rowIndex].reason_analysis =0;
                    this.step1=true;
                    this.step2=false;
                    this.message[k]={
                      mess_receiver:this.tableData[k].section_principal_id,
                      mess_type:11,
                      mess_link:'/defectFixed'
                    };
                    this.step3=false;
                    this.step4=true;
                    this.step5=false;
                    this.putMessage(this.message);
                  }else{
                    this.$alert(res.data.message,'提示');
                  }
                })
            }
          }
        }
      }
//          保存第三步
    }else  if((this.row.section_principal_id==this.user_id||this.row.guidance_id==this.user_id)
      &&(this.row.compile_rectificationplan_state[0]==1
      ||this.row.compile_rectificationplan_state[1]==1&&
      this.row.review_opinions==1&&this.row.reCheck==1
      &&this.step3)&&!this.step5){
      console.log('复核整改计划第三步操作');
      console.log(this.row.rectification_state)
//            复核整改计划 一条数据或者两条数据
      if(this.row.review_rectificationplan_state[0]==0&&this.row.compile_rectificationplan_state[0]==1
        &&this.row.review_rectificationplan_state[1]==undefined){
//               第一条数据  整改人完成填写 只有一条数据需要提交 （共一条）;

        this.axios.put('/api/v1/flaw/reviewrectificationplan/'+`${this.row.dere_id}`,{
          rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1],
          rectification_state:[this.row.rectification_state[0]],
          dere_id:this.row.dere_id
        })
          .then((res)=>{
            if(res.data.code==0){
              this.$alert('操作成功','提示');
              this.disabled =0;
              this.tableData[this.rowIndex].disabled =0;
              this.tableData[this.rowIndex].reason_analysis =0;
              this.tableData[this.rowIndex].reCheck =0;
              this.step1=true;
              this.step2=false,
                this.step3=false;
              if(this.row.rectification_state[0]==1){
//复核通过
                this.message[0]={
                  mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                  mess_type:12,
                  mess_link:'/defectFixed'
                };
              }else if(this.row.rectification_state[0]==2){
//复核未通过
                this.message[0]={
                  mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                  mess_type:11,
                  mess_link:'/defectFixed'
                };
              }
              this.step4=true;
              this.step5=false;
              this.putMessage(this.message)
            }else{
              this.$alert(res.data.message,'提示')
            }
          })
      }else if(this.row.review_rectificationplan_state[0]==0&&this.row.review_rectificationplan_state[1]==1){

        this.axios.put('/api/v1/flaw/reviewrectificationplan/'+`${this.row.dere_id}`,{
          rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1],
          rectification_state:[this.row.rectification_state[0]],
          dere_id:this.row.dere_id
        })
          .then((res)=>{
            if(res.data.code==0){
              this.$alert('操作成功','提示');
              this.disabled =0;
              this.tableData[this.rowIndex].disabled =0;
              this.tableData[this.rowIndex].reason_analysis =0;
              this.tableData[this.rowIndex].reCheck =0;
              this.step1=true;
              this.step2=false;
//复核整改第一个未通过  第2个通过
              this.message[0]={
                mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                mess_type:11,
                mess_link:'/defectFixed'
              };
              this.message[1]={
                mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                mess_type:12,
                mess_link:'/defectFixed'
              };
              this.step3=false;
              this.step4=true;
              this.step5=false;
              this.putMessage(this.message)
            }else{
              this.$alert(res.data.message,'提示')
            }
          })

      }else if(this.row.review_rectificationplan_state[0]==1&&this.row.review_rectificationplan_state[1]==0){
        console.log(this.row.rectification_state)
        this.axios.put('/api/v1/flaw/reviewrectificationplan/'+`${this.row.dere_id}`,{
          rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1,this.defect_source.indexOf(this.row.defect_source[1])*1+1],
          rectification_state:[this.row.rectification_state[0],this.row.rectification_state[1]],
          dere_id:this.row.dere_id
        })
          .then((res)=>{
            if(res.data.code==0){
              this.$alert('操作成功','提示');
              this.disabled =0;
              this.tableData[this.rowIndex].disabled =0;
              this.tableData[this.rowIndex].reason_analysis =0;
              this.tableData[this.rowIndex].reCheck =0;
//复核整改第一个通过 第2个未通过
              this.message[0]={
                mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                mess_type:12,
                mess_link:'/defectFixed'
              };
              this.message[1]={
                mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                mess_type:11,
                mess_link:'/defectFixed'
              };
              this.step1=true;
              this.step2=false;
              this.step3=false;
              this.step4=true;
              this.step5=false;
              this.putMessage(this.message)
            }else{
              this.$alert(res.data.message,'提示')
            }
          })


      }else if(this.row.review_rectificationplan_state[0]==1&&this.row.review_rectificationplan_state[1]==1){
//复核整改第一个通过 第2个通过
        alert(88888)
        this.axios.put('/api/v1/flaw/reviewrectificationplan/'+`${this.row.dere_id}`,{
          rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1],
          rectification_state:[this.row.rectification_state[0]],
          dere_id:this.row.dere_id
        })
          .then((res)=>{
            if(res.data.code==0){
              this.message[0]={
                mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                mess_type:12,
                mess_link:'/defectFixed'
              };
              this.message[1]={
                mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                mess_type:12,
                mess_link:'/defectFixed'
              };
              this.$alert('操作成功','提示');
              this.disabled =0;
              this.tableData[this.rowIndex].disabled =0;
              this.tableData[this.rowIndex].reason_analysis =0;
              this.tableData[this.rowIndex].reCheck =0;
              this.step1=true;
              this.step2=false;

              this.step3=false;
              this.step4=true;
              this.step5=false;
              this.putMessage(this.message)
            }else{
              this.$alert(res.data.message,'提示')
            }
          })
      }else if(this.row.review_rectificationplan_state[0]==0&&this.row.review_rectificationplan_state[1]==0){
//复核整改第一个未通过 第2个未通过

        this.axios.put('/api/v1/flaw/reviewrectificationplan/'+`${this.row.dere_id}`,{
          rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1],
          rectification_state:[this.row.rectification_state[0]],
          dere_id:this.row.dere_id
        })
          .then((res)=>{
            if(res.data.code==0){
              this.$alert('操作成功','提示');
              this.disabled =0;
              this.tableData[this.rowIndex].disabled =0;
              this.tableData[this.rowIndex].reason_analysis =0;
              this.tableData[this.rowIndex].reCheck =0;
              this.step1=true;
              this.step2=false;
              this.message[0]={
                mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                mess_type:11,
                mess_link:'/defectFixed'
              };
              this.message[1]={
                mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                mess_type:11,
                mess_link:'/defectFixed'
              };
              this.step3=false;
              this.step4=true;
              this.step5=false;
              this.putMessage(this.message)
            }else{
              this.$alert(res.data.message,'提示')
            }
          })
      }
      else{
//                复核整改计划有两个
        console.log('复核整改计划存在两个');
        if(this.row.compile_rectificationplan_state[0]==1&&this.row.compile_rectificationresult_state[0]==0
          &&this.row.compile_rectificationresult_state[1]==1
        ){

//第四步整改结果 第一个未做完 第二个已经做好

//                /api/v1/flaw/compilerectificationresult/
          this.axios.put('/api/v1/flaw/reviewrectificationplan/'+`${this.row.dere_id}`,{
            rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1],
            rectification_state:[this.row.rectification_state[0]],
            dere_id:this.row.dere_id
          })
            .then((res)=>{
              if(res.data.code==0){
                this.$alert('操作成功','提示');
                this.disabled =0;
                if(this.row.rectification_state[0]==1){
//复核通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                    mess_type:12,
                    mess_link:'/defectFixed'
                  };
                }else if(this.row.rectification_state[0]==2){
//复核未通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                    mess_type:11,
                    mess_link:'/defectFixed'
                  };
                }
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.putMessage(this.message)
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }else if(this.row.compile_rectificationplan_state[1]==1&&this.row.compile_rectificationresult_state[1]==0
          &&(this.row.compile_rectificationplan_state[0]==0&&this.row.compile_rectificationresult_state[0]==0)
        ){
//第一个编制整改  第一步完成 第二个编制整改未完成（1）

          this.axios.put('/api/v1/flaw/reviewrectificationplan/'+`${this.row.dere_id}`,{
            rectification_type:[this.defect_source.indexOf(this.row.defect_source[1])*1+1],
            rectification_state:[this.row.rectification_state[1]],
            dere_id:this.row.dere_id
          })
            .then((res)=>{
              if(res.data.code==0){
                this.$alert('操作成功','提示');
                this.disabled =0;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
                if(this.row.rectification_state[1]==1){
//复核通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                    mess_type:12,
                    mess_link:'/defectFixed'
                  };
                }else if(this.row.rectification_state[1]==2){
//复核未通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                    mess_type:11,
                    mess_link:'/defectFixed'
                  };
                };
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.putMessage(this.message)
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }else{
//第一条数据的复核状态
          if(this.row.review_rectificationplan_state.length==2){
            if(this.row.review_rectificationplan_state[0]==1&&this.row.review_rectificationplan_state[1]==0){
//复核整改第一步完成
//提交的是复核整改的数据  第三不
              console.log('第四步操作，提交整改人员的确认数据');

              this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
                rectification_results:[this.row.rectification_results[0]],
                reasons_measures:[this.row.reasons_measures[0]]
              })
                .then((res)=>{
                  if(res.data.code==0){
                    this.$alert(res.data.message,'提示');
                    this.disabled =0;
                    this.step1=true;
                    this.step2=false;
                    if(this.row.rectification_results[0]){
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].evaluator_id,
                        mess_type:14,
                        mess_link:'/defectFixed'
                      };
                    }
                    this.step3=false;
                    this.step4=true;
                    this.step5=false;
                    this.tableData[this.rowIndex].disabled =0;
                    this.tableData[this.rowIndex].reason_analysis =0;
                    this.tableData[this.rowIndex].reCheck =0;
                    this.putMessage(this.message)
                  }else{
                    this.$alert(res.data.message,'提示')
                  }
                })
            }else if(this.row.review_rectificationplan_state[0]==1&&this.row.review_rectificationplan_state[1]==1){
//复核整改2个都完成
              console.log('第四步操作，提交整改人员的确认数据sad');
              if(this.user_id==this.row.mend_principal[0].id&&this.row.mend_principal[0].id==this.row.mend_principal[1].id){

                this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
                  rectification_results:[this.row.rectification_results[0],this.row.rectification_results[1]],
                  reasons_measures:[this.row.reasons_measures[0],this.row.reasons_measures[1]]
                })
                  .then((res)=>{
                    if(res.data.code==0){
                      if(this.row.rectification_results[0]){
                        this.message[0]={
                          mess_receiver:this.tableData[this.row.index].evaluator_id,
                          mess_type:14,
                          mess_link:'/defectFixed'
                        };
                      }
                      if(this.user_id==this.row.mend_principal[1].id){
                        if(this.row.rectification_results[1]){
                          this.message[1]={
                            mess_receiver:this.tableData[this.row.index].evaluator_id,
                            mess_type:14,
                            mess_link:'/defectFixed'
                          };
                        }
                      };
                      this.$alert(res.data.message,'提示');
                      this.disabled =0;
                      this.step1=true;
                      this.step2=false;
                      this.step3=false;
                      this.step4=true;
                      this.step5=false;
                      this.tableData[this.rowIndex].disabled =0;
                      this.tableData[this.rowIndex].reason_analysis =0;
                      this.tableData[this.rowIndex].reCheck =0;
                      this.putMessage(this.message)
                    }else{
                      this.$alert(res.data.message,'提示')
                    }
                  })
              }else if(this.user_id==this.row.mend_principal[0].id&&this.row.mend_principal[0].id!=this.row.mend_principal[1].id){

                this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
                  rectification_results:[this.row.rectification_results[0]],
                  reasons_measures:[this.row.reasons_measures[0]]
                })
                  .then((res)=>{
                    if(res.data.code==0){
                      this.$alert(res.data.message,'提示');
                      this.disabled =0;
                      this.step1=true;
                      this.step2=false;
                      if(this.row.rectification_results[0]){
                        this.message[0]={
                          mess_receiver:this.tableData[this.row.index].evaluator_id,
                          mess_type:14,
                          mess_link:'/defectFixed'
                        };
                      };
                      this.step3=false;
                      this.step4=true;
                      this.step5=false;
                      this.tableData[this.rowIndex].disabled =0;
                      this.tableData[this.rowIndex].reason_analysis =0;
                      this.tableData[this.rowIndex].reCheck =0;
                      this.putMessage(this.message)
                    }else{
                      this.$alert(res.data.message,'提示')
                    }
                  })
              }else if(this.user_id==this.row.mend_principal[1].id&&this.row.mend_principal[0].id!=this.row.mend_principal[1].id){

                this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
                  rectification_results:[this.row.rectification_results[1]],
                  reasons_measures:[this.row.reasons_measures[1]]
                })
                  .then((res)=>{
                    if(res.data.code==0){
                      this.$alert(res.data.message,'提示');
                      this.disabled =0;
                      this.step1=true;
                      this.step2=false;
                      if(this.row.rectification_results[1]){
                        this.message[0]={
                          mess_receiver:this.tableData[this.row.index].evaluator_id,
                          mess_type:14,
                          mess_link:'/defectFixed'
                        };
                      }
                      this.step3=false;
                      this.step4=true;
                      this.step5=false;
                      this.tableData[this.rowIndex].disabled =0;
                      this.tableData[this.rowIndex].reason_analysis =0;
                      this.tableData[this.rowIndex].reCheck =0;
                      this.putMessage(this.message)
                    }else{
                      this.$alert(res.data.message,'提示')
                    }
                  })
              }
              console.log([this.row.rectification_results[0],this.row.rectification_results[1]]);
              console.log([this.row.reasons_measures[0],this.row.reasons_measures[1]])
//                      this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
//                        rectification_results:[this.row.rectification_results[0],this.row.rectification_results[1]],
//                        reasons_measures:[this.row.reasons_measures[0],this.row.reasons_measures[1]]
//                      })
//                        .then((res)=>{
//                          if(res.data.code==0){
//                            this.$alert(res.data.message,'提示');
//                            this.disabled =0;
//                            this.step1=true;
//                            this.step2=false;
//                            this.step3=false;
//                            this.step4=true;
//                            this.step5=false;
//                            this.tableData[this.rowIndex].disabled =0;
//                            this.tableData[this.rowIndex].reason_analysis =0;
//                            this.tableData[this.rowIndex].reCheck =0;
//                          }else{
//                            this.$alert(res.data.message,'提示')
//                          }
//                        })

            }else if(this.row.review_rectificationplan_state[0]==0&&this.row.review_rectificationplan_state[1]==1){
//复核整改第2个完成
              console.log('第四步操作，提交整改人员的确认数据');

              this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
                rectification_results:[this.row.rectification_results[1]],
                reasons_measures:[this.row.reasons_measures[1]]
              })
                .then((res)=>{
                  if(res.data.code==0){
                    this.$alert(res.data.message,'提示');
                    this.disabled =0;
                    this.step1=true;
                    this.step2=false;
                    this.step3=false;
                    if(this.row.rectification_results[1]){
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].evaluator_id,
                        mess_type:14,
                        mess_link:'/defectFixed'
                      };
                    }
                    this.step4=true;
                    this.step5=false;
                    this.tableData[this.rowIndex].disabled =0;
                    this.tableData[this.rowIndex].reason_analysis =0;
                    this.tableData[this.rowIndex].reCheck =0;
                    this.putMessage(this.message)
                  }else{
                    this.$alert(res.data.message,'提示')
                  }
                })
            }
          }else {
            if(this.row.review_rectificationplan_state[0]==1){
              console.log('第四步操作，提交整改人员的确认数据');

              this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
                rectification_results:[this.row.rectification_results[0]],
                reasons_measures:[this.row.reasons_measures[0]]
              })
                .then((res)=>{
                  if(res.data.code==0){
                    this.$alert(res.data.message,'提示');
                    this.disabled =0;
                    this.step1=true;
                    this.step2=false;
                    this.step3=false;
                    if(this.row.rectification_results[1]){
                      this.message[0]={
                        mess_receiver:this.tableData[this.row.index].evaluator_id,
                        mess_type:14,
                        mess_link:'/defectFixed'
                      };
                    }
                    this.step4=true;
                    this.step5=false;
                    this.tableData[this.rowIndex].disabled =0;
                    this.tableData[this.rowIndex].reason_analysis =0;
                    this.tableData[this.rowIndex].reCheck =0;
                    this.putMessage(this.message)
                  }else{
                    this.$alert(res.data.message,'提示')
                  }
                })
            }
          }

          this.axios.put('/api/v1/flaw/reviewrectificationplan/'+`${this.row.dere_id}`,{
            rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1,this.defect_source.indexOf(this.row.defect_source[1])*1+1],
            rectification_state:[this.row.rectification_state[0],this.row.rectification_state[1]],
            dere_id:this.row.dere_id
          })
            .then((res)=>{
              if(res.data.code==0){
                this.$alert('操作成功','提示');
                this.disabled =0;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
                if(this.row.rectification_state[0]==1){
//复核通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                    mess_type:12,
                    mess_link:'/defectFixed'
                  };
                }else if(this.row.rectification_state[0]==2){
//复核未通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                    mess_type:11,
                    mess_link:'/defectFixed'
                  };
                }
//第2条数据的复核状态
                if(this.row.rectification_state[1]==1){
//复核通过
                  this.message[1]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                    mess_type:12,
                    mess_link:'/defectFixed'
                  };
                }else if(this.row.rectification_state[1]==2){
//复核未通过
                  this.message[1]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                    mess_type:11,
                    mess_link:'/defectFixed'
                  };
                };
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.putMessage(this.message);
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }
      }
//          保存第四步  指定的整改人员的操作区间
    }else if(this.row.compile_rectificationplan_state[0]==1
      ||this.row.compile_rectificationplan_state[1]==1
      &&(this.row.mend_principal[0].id==this.user_id||
      this.row.mend_principal[1].id==this.user_id)&&this.step4){
//            alert('第四步')
      if(this.step5&&this.user_id==this.row.evaluator_id){
//只有一个整改结果
        console.log('第五步操作，评价人员的最后提交');
        if(this.row.compile_rectificationresult_state[0]
          &&!this.row.compile_rectificationresult_state[1]){


          this.axios.put('/api/v1/flaw/implementrectificationresult/'+`${this.row.dere_id}`,{
            rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1],
            def_rec_state:[this.row.def_rec_state[0]],
            implementation_opinions:[this.row.implementation_opinions[0]],
          })
            .then((res)=>{
              if(res.data.code==0){
                if(this.row.def_rec_state[0]==1){
//复核通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                    mess_type:16,
                    mess_link:'/defectFixed'
                  };
                }else if(this.row.def_rec_state[0]==2){
//复核未通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                    mess_type:15,
                    mess_link:'/defectFixed'
                  };
                }
                this.$alert(res.data.message,'提示');
                this.disabled =0;
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
                console.log(this.message)
                this.putMessage(this.message);
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }else if(this.row.compile_rectificationresult_state[1]
          &&!this.row.compile_rectificationresult_state[0]){
//                      alert(456)

          this.axios.put('/api/v1/flaw/implementrectificationresult/'+`${this.row.dere_id}`,{
            rectification_type:[this.defect_source.indexOf(this.row.defect_source[1])*1+1],
            def_rec_state:[this.row.def_rec_state[1]],
            implementation_opinions:[this.row.implementation_opinions[1]],
          })
            .then((res)=>{
              if(res.data.code==0){
                if(this.row.def_rec_state[1]==1){
//复核通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                    mess_type:16,
                    mess_link:'/defectFixed'
                  };
                }else if(this.row.def_rec_state[1]==2){
//复核未通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                    mess_type:15,
                    mess_link:'/defectFixed'
                  };
                }
                this.disabled =0;
                this.$alert(res.data.message,'提示');
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
                this.putMessage(this.message)
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }else if(this.row.compile_rectificationresult_state[1]
          &&this.row.compile_rectificationresult_state[0]){
//                      alert(789)

          this.axios.put('/api/v1/flaw/implementrectificationresult/'+`${this.row.dere_id}`,{
            rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1,this.defect_source.indexOf(this.row.defect_source[1])*1+1],
            def_rec_state:[this.row.def_rec_state[0],this.row.def_rec_state[1]],
            implementation_opinions:[this.row.implementation_opinions[0],this.row.implementation_opinions[1]],
          })
            .then((res)=>{
              if(res.data.code==0){
                this.disabled =0;
                if(this.row.def_rec_state[0]==1){
//复核通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                    mess_type:16,
                    mess_link:'/defectFixed'
                  };
                }else if(this.row.def_rec_state[0]==2){
//复核未通过
                  this.message[0]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                    mess_type:15,
                    mess_link:'/defectFixed'
                  };
                };
                if(this.row.def_rec_state[1]==1){
//复核通过
                  this.message[1]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                    mess_type:16,
                    mess_link:'/defectFixed'
                  };
                }else if(this.row.def_rec_state[1]==2){
//复核未通过
                  this.message[1]={
                    mess_receiver:this.tableData[this.row.index].mend_principal[1].id,
                    mess_type:15,
                    mess_link:'/defectFixed'
                  };
                }
                this.$alert(res.data.message,'提示');
                this.step1=true;
                this.step2=false;
                this.step3=false;
                this.step4=true;
                this.step5=false;
                this.tableData[this.rowIndex].disabled =0;
                this.tableData[this.rowIndex].reason_analysis =0;
                this.tableData[this.rowIndex].reCheck =0;
                this.putMessage(this.message);
              }else{
                this.$alert(res.data.message,'提示')
              }
            })
        }else{
        }
      }else{
        console.log('第四步操作，提交整改人员的确认数据');


        this.axios.put('/api/v1/flaw/compilerectificationresult/'+`${this.row.dere_id}`,{
          rectification_results:[this.row.rectification_results[0],this.row.rectification_results[1]],
          reasons_measures:[this.row.reasons_measures[0],this.row.reasons_measures[1]]
        })
          .then((res)=>{
            if(res.data.code==0){
              if(this.row.rectification_results[0]){
                this.message[0]={
                  mess_receiver:this.tableData[this.row.index].evaluator_id,
                  mess_type:14,
                  mess_link:'/defectFixed'
                };
              }
              if(this.row.rectification_results[1]){
                this.message[1]={
                  mess_receiver:this.tableData[this.row.index].evaluator_id,
                  mess_type:14,
                  mess_link:'/defectFixed'
                };
              };
              this.$alert(res.data.message,'提示');
              this.disabled =0;
              this.step1=true;
              this.step2=false;
              this.step3=false;
              this.step4=true;
              this.step5=false;
              this.tableData[this.rowIndex].disabled =0;
              this.tableData[this.rowIndex].reason_analysis =0;
              this.tableData[this.rowIndex].reCheck =0;
              this.putMessage(this.message)
            }else{
              this.$alert(res.data.message,'提示')
            }
          })
      }
// 整改结果数据提交
//          rectification_results  整改数据
//      rectification_results_input  填写标识
    }else if(this.row.evaluator_id==this.user_id
      &&this.row.compile_rectificationresult_state[0]==1
    ){
//            LASTONE
      console.log('评价人员操作确认缺陷信息');
//第五步完成需要对第四步进行反馈
      console.log(this.row.compile_rectificationresult_state[0])
      if(this.row.compile_rectificationresult_state[0]==1&&this.row.compile_rectificationresult_state[1]==undefined){

        console.log(this.row.def_rec_state);
        this.axios.put('/api/v1/flaw/implementrectificationresult/'+`${this.row.dere_id}`,{
          rectification_type:[this.defect_source.indexOf(this.row.defect_source[0])*1+1],
          implementation_opinions:[this.row.implementation_opinions[0]],
          def_rec_state:[this.row.def_rec_state[0]],
        })
          .then((res)=>{
            if(res.data.code==0){
              if(this.row.def_rec_state[0]==1){
//第五步 评价人员认同
                this.message[0]={
                  mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                  mess_type:16,
                  mess_link:'/defectFixed'
                };
              }else if(this.row.def_rec_state[0]==2){
//第五步 评价人员不认同
                this.message[0]={
                  mess_receiver:this.tableData[this.row.index].mend_principal[0].id,
                  mess_type:15,
                  mess_link:'/defectFixed'
                };
              };
              this.$alert(res.data.message,'提示');
              this.disabled =0;
              this.step1=true;
              this.step2=false;
              this.step3=false;
              this.step4=true;
              this.step5=false;
              this.putMessage(this.message)
            }else{
              this.$alert(res.data.message,'提示')
            }
          })
      }else if(this.row.compile_rectificationresult_state[0]==1&&this.row.compile_rectificationresult_state[1]==1){

      }else if(this.row.compile_rectificationresult_state[1]==1&&this.row.compile_rectificationresult_state[0]==0){

      }
    }
  },
</script>
